package io.gitee.wiqer.easy;

import org.junit.Test;

import java.nio.charset.StandardCharsets;

public class SolutionNC103_Solve {
    /**
     * 反转字符串
     * @param str string字符串
     * @return string字符串
     */
    public String solve (String str) {
        // write code here
        byte[] arr= str.getBytes(StandardCharsets.UTF_8);
        byte[]  arrTemp= new byte[arr.length];
        int index= arr.length-1;
        while (index >=0) {
            arrTemp[index]=arr[arr.length-index-1];
            index--;
        }
        return  new String(arrTemp);
    }
    @Test
    public void test(){
        System.out.println(solve("abcd"));
    }
}
